<route lang="json5">
{
  layout: 'tabbar',
  style: {
    // 'custom' 表示开启自定义导航栏，默认 'default'
    navigationStyle: 'default',
    navigationBarTitleText: '工作台',
  },
}
</route>

<script lang="ts" setup>
import { ref } from 'vue'
import { useToast } from 'wot-design-uni'

const toast = useToast()

// const current = ref<number>(0)
// // const swiperDotIndex = ref(0)
// const data = ref([
//   { image: '/static/images/banner/banner01.jpg' },
//   { image: '/static/images/banner/banner02.jpg' },
//   { image: '/static/images/banner/banner03.jpg' },
// ])

// function clickBannerItem(item, index) {
//   console.info(item, index)
// }

// function changeSwiper(e) {
//   // wd-swiper 返回的是索引值而不是 detail.current
//   current.value = e
// }

function changeGrid() {
  toast.show('模块建设中~')
}

const current = ref<number>(0)

const swiperList = ref([
  '/static/images/banner/banner01.jpg',
  '/static/images/banner/banner02.jpg',
  '/static/images/banner/banner03.jpg',
])
function handleClick(e) {
  console.log(e)
}
function onChangeSwiper(e) {
  console.log(e)
}
</script>

<template>
  <view class="work-container">
    <!-- 轮播图 -->
    <!-- <uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">
      <swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
        <swiper-item v-for="(item, index) in data" :key="index">
          <view class="swiper-item" @click="clickBannerItem(item)">
            <image :src="item.image" mode="aspectFill" :draggable="false" />
          </view>
        </swiper-item>
      </swiper>
    </uni-swiper-dot> -->

    <!-- 图片默认是 aspectFill -->
    <wd-swiper
      v-model:current="current"
      :list="swiperList"
      autoplay
      :indicator="{ type: 'dots-bar' }"
      image-mode="aspectFit"
      @click="handleClick"
      @change="onChangeSwiper"
    />

    <!-- 宫格组件 -->
    <!-- <uni-section title="系统管理" type="line" /> -->
    <!-- <view class="grid-body">
      <uni-grid :column="4" :show-border="false" @change="changeGrid">
        <uni-grid-item>
          <view class="grid-item-box">
            <uni-icons type="person-filled" size="30" />
            <text class="text">
              用户管理
            </text>
          </view>
        </uni-grid-item>
        <uni-grid-item>
          <view class="grid-item-box">
            <uni-icons type="staff-filled" size="30" />
            <text class="text">
              角色管理
            </text>
          </view>
        </uni-grid-item>
        <uni-grid-item>
          <view class="grid-item-box">
            <uni-icons type="color" size="30" />
            <text class="text">
              菜单管理
            </text>
          </view>
        </uni-grid-item>
        <uni-grid-item>
          <view class="grid-item-box">
            <uni-icons type="settings-filled" size="30" />
            <text class="text">
              部门管理
            </text>
          </view>
        </uni-grid-item>
        <uni-grid-item>
          <view class="grid-item-box">
            <uni-icons type="heart-filled" size="30" />
            <text class="text">
              岗位管理
            </text>
          </view>
        </uni-grid-item>
        <uni-grid-item>
          <view class="grid-item-box">
            <uni-icons type="bars" size="30" />
            <text class="text">
              字典管理
            </text>
          </view>
        </uni-grid-item>
        <uni-grid-item>
          <view class="grid-item-box">
            <uni-icons type="gear-filled" size="30" />
            <text class="text">
              参数设置
            </text>
          </view>
        </uni-grid-item>
        <uni-grid-item>
          <view class="grid-item-box">
            <uni-icons type="chat-filled" size="30" />
            <text class="text">
              通知公告
            </text>
          </view>
        </uni-grid-item>
        <uni-grid-item>
          <view class="grid-item-box">
            <uni-icons type="wallet-filled" size="30" />
            <text class="text">
              日志管理
            </text>
          </view>
        </uni-grid-item>
      </uni-grid>
    </view> -->

    <!-- <wd-text type="primary" text="系统管理" /> -->
    <wd-navbar left-text="系统管理" />
    <view class="grid-body">
      <wd-grid :column="4">
        <wd-grid-item icon="user" text="用户管理" @click="changeGrid" />
        <wd-grid-item icon="usergroup" text="角色管理" @click="changeGrid" />
        <wd-grid-item icon="menu-fold" text="菜单管理" @click="changeGrid" />
        <wd-grid-item icon="fork" text="部门管理" @click="changeGrid" />
        <wd-grid-item icon="computer" text="岗位管理" @click="changeGrid" />
        <wd-grid-item icon="a-rootlist" text="字典管理" @click="changeGrid" />
        <wd-grid-item icon="setting" text="参数设置" @click="changeGrid" />
        <wd-grid-item icon="notification" text="通知公告" @click="changeGrid" />
        <wd-grid-item icon="spool" text="日志管理" @click="changeGrid" />
      </wd-grid>
    </view>
    <wd-toast />
  </view>
</template>

<style lang="scss" scoped>
  /* #ifndef APP-NVUE */
  page {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background-color: #fff;
    min-height: 100%;
    height: auto;
  }

  view {
    font-size: 14px;
    line-height: inherit;
  }
  /* #endif */

  .text {
    text-align: center;
    font-size: 26rpx;
    margin-top: 10rpx;
  }

  .grid-item-box {
    flex: 1;
    /* #ifndef APP-NVUE */
    display: flex;
    /* #endif */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 0;
  }

  .uni-margin-wrap {
    width: 690rpx;
    width: 100%;
    ;
  }

  .swiper {
    height: 300rpx;
  }

  .swiper-box {
    height: 150px;
  }

  .swiper-item {
    /* #ifndef APP-NVUE */
    display: flex;
    /* #endif */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    height: 300rpx;
    line-height: 300rpx;
  }

  @media screen and (min-width: 500px) {
    .uni-swiper-dot-box {
      width: 400px;
      /* #ifndef APP-NVUE */
      margin: 0 auto;
      /* #endif */
      margin-top: 8px;
    }

    .image {
      width: 100%;
    }
  }
</style>
